<template>
    <Modal title="设置成本" @on-visible-change="showModal" v-model="show" :closable="false" :mask-closable="false">
        <el-form ref="back" label-position="right" label-width="80px">
            <el-form-item label="设置成本" prop="cost">
                <el-input size="small"  type="text" v-model="cost" placeholder="设置成本" style="width: 240px" />
            </el-form-item>
             <el-form-item label="供货价" prop="salePrice">
                <el-input size="small"  type="text" v-model="salePrice" placeholder="供货价" style="width: 240px" />
            </el-form-item>
       </el-form>
        <div slot="footer">
            <el-button size="small"  @click="cancel">取消</el-button>
            <el-button @click="ok" type="success" size="small" :loading="loading">修改</el-button>
        </div>
    </Modal>
</template>
<script>
export default {
    name: "CXiapiCost",
    data() {
        return {
            loading: false,
            cost: 0,
            salePrice:0,
            show:false,
        }
    },
    props: [
         
    ],
    methods: {
        showModal: function(val) {
         
        },
        showDialog:function(ids){
            this.ids=ids;
            this.show=true;
        },
        getList: function() {
            var me = this;
            me.loading = true;
            me.$http.post("/storageproduct/setCost.do", {salePrice:me.salePrice, ids: me.ids, cost: me.cost }).then(response => {
                 me.loading = false;
                
                var body = response;
                if (body.status == 0) {
                    me.$emit('ok');
                    me.show=false;
                }
               
            }, response => {
                me.loading = false;
            });
        },
        ok: function() {
            this.getList();
        },
        cancel: function() {
            this.show=false;
            this.$emit('cancel')
        }

    }
}
</script>
<style scoped>
.ivu-alert-with-desc {
    padding: 0px 16px;
}

.time {
    font-size: 14px;
    font-weight: bold;
}

.content {
    padding-left: 5px;
    word-wrap: break-word;
}
</style>